package com.itheima.web.controller;


import com.itheima.doamin.system.User;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class BaseController {

    @Autowired
    protected HttpServletRequest request;
    @Autowired
    protected HttpSession session;
    @Autowired
    protected HttpServletResponse response;


    //获得当前登录的用户对象
    public User getCurrentUser(){
        return (User)session.getAttribute("user");
    }



//    @ModelAttribute
//    public void setReqAndResp(HttpServletRequest request, HttpServletResponse response, HttpSession session) {
//        this.request = request;
//        this.response = response;
//        this.session = session;
//        //模拟数据
//	    //user = (User)session.getAttribute("loginUser");
//	    //if(user != null) {
//		//    this.companyId = user.getCompanyId();
//		//    this.companyName=user.getCompanyName();
//	    //}
//    }
}
